<!DOCTYPE html>
<html>

	<head>

		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">

		<title>生产物料管理</title>
		<meta name="keywords" content="">
		<meta name="description" content="">

		<link rel="shortcut icon" href="favicon.ico">
		<link href="__STATIC__/layout/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
		<link href="__STATIC__/layout/css/font-awesome.css?v=4.4.0" rel="stylesheet">

		<link href="__STATIC__/layout/css/animate.css" rel="stylesheet">
		<link href="__STATIC__/layout/css/style.css?v=4.1.0" rel="stylesheet">
		<link href="__STATIC__/layout/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
		<link rel="stylesheet" href="__STATIC__/zTreeStyle/demo.css" type="text/css">
		<link rel="stylesheet" href="__STATIC__/zTreeStyle/zTreeStyle.css" type="text/css">
		<link href="__STATIC__/layout/css/gyq.css" rel="stylesheet">
		<link rel="stylesheet" href="__STATIC__/layout/css/demo.css" type="text/css">
		<script src="__STATIC__/layout/js/jquery.min.js?v=2.1.4"></script>
    	<script src="__STATIC__/sc/js/page.js"></script>
		<style>
			#alertmod_table_list_2 {
				top: 900px !important;
			}
			
			.alerts {
				display: none;
				position: fixed;
				top: 0;
				left: 0;
				width: 100%;
				height: 100%;
				background: rgba(0, 0, 0, 0.5);
			}
			
			.alerts .alerts_content {
				background: #fff;
				position: fixed;
				top: 50%;
				left: 50%;
				width: 700px;
				min-height: 500px;
				margin: -220px 0 0 -350px;
				padding: 5px;
				border: 4px solid #ccc/* margin 负值为宽高的一半 */
			}
			
			.wait {
				display: none;
				background: #f4f4f5;
				position: fixed;
				top: 50%;
				left: 50%;
				width: 700px;
				min-height: 250px;
				margin: -220px 0 0 -350px;
				padding: 5px;
				border: 4px solid #ccc/* margin 负值为宽高的一半 */
			}
			
			.alerts .alerts_content h3 {
				font-weight: normal;
				text-align: left;
				line-height: 24px;
				font-size: 20px;
				padding-left: 1%;
				width: 99%;
				margin-bottom: 30px;
				background: #d0e0e0
			}
			
			.alerts .alerts_content .alerts_form {
				width: 100%;
			}
			
			.alert_addNewZone_tree {
				display: none;
				position: fixed;
				top: 0;
				left: 0;
				width: 100%;
				height: 100%;
				background: rgba(0, 0, 0, 0.5);
			}
			
			.alert_addNewZone_tree .alert_addNewZone_content_tree {
				background: #fff;
				position: fixed;
				top: 50%;
				left: 50%;
				width: 500px;
				height: 300px;
				margin: -150px 0 0 -250px;
				padding: 5px;
				border: 4px solid #ccc/* margin 负值为宽高的一半 */
			}
			
			.alert_addNewZone_tree .alert_addNewZone_content_tree h3 {
				font-weight: normal;
				text-align: left;
				line-height: 24px;
				font-size: 20px;
				padding-left: 1%;
				width: 99%;
				margin-bottom: 30px;
				background: #d0e0e0
			}
			
			.alert_addNewZone .alert_addNewZone_content .alert_addNewZone_form {
				width: 100%;
			}
			
			.alert_addNewZone_tree .alert_addNewZone_content_tree .alert_addNewZone_form_tree {
				height: 280px;
				overflow: scroll;
			}
			
			.alerts .alerts_content .alerts_form form {
				width: 100%;
			}
			
			.alerts .alerts_content .alerts_form form div {
				margin-bottom: 30px;
				width: 100%;
				text-align: center;
			}
			
			.alerts .alerts_content .alerts_form form div label {
				display: inline-block;
				width: 130px;
				text-align: right;
			}
			
			.alerts .alerts_content .alerts_form form div:nth-of-type(1) input {
				margin-right: 28px;
			}
			
			.mtp {
				margin-top: 3px;
			}
			
			.no-padding {
				padding: 0;
			}
			
			#gopage {
				color: blue;
				cursor: pointer;
			}
			
			#firstpage {
				cursor: pointer;
			}
			
			.alert_addNewZone_tree {
				display: none;
				position: fixed;
				top: 0;
				left: 0;
				width: 100%;
				height: 100%;
				background: rgb(255, 255, 255, 0.7);
				z-index: 200
			}
			
			.alert_addNewZone_tree .alert_addNewZone_content_tree {
				background: #fff;
				position: fixed;
				top: 50%;
				left: 50%;
				width: 500px;
				height: 350px;
				margin: -150px 0 0 -250px;
				padding: 5px;
				border: 4px solid #ccc/* margin 负值为宽高的一半 */
			}
			
			.wait,
			.waits {
				background: #f4f4f5;
				position: fixed;
				top: 50%;
				left: 50%;
				width: 500px;
				height: 300px;
				margin: -150px 0 0 -250px;
				padding: 5px;
				border: 4px solid #ccc/* margin 负值为宽高的一半 */
			}
			
			.alert_addNewZone_tree .alert_addNewZone_content_tree h3 {
				font-weight: normal;
				text-align: left;
				line-height: 24px;
				font-size: 20px;
				padding-left: 1%;
				width: 99%;
				margin-bottom: 10px;
				background: #d0e0e0
			}
		</style>
	</head>

	<body class="white-bg" style="color:#333;padding:3px;">
		<div class="page-heade">
			<h2 class="title_color text-center">生产物料管理</h2>
		</div>
		<div class="col-md-12 mtp no-padding">

			<table class="table table-bordered" style="width: 100%;">
				<tbody>
					<tr>
						<td colspan="6">
							<input type="button" value="新增" class="btn btn-sm btn-primary add" />
							<input type="button" value="导入" class="btn btn-sm btn-primary" />

							<input type="button" value="回收站" class="btn btn-sm btn-primary huishou" style="float: right;" />

						</td>
					</tr>
					<form action="#" method="post" id="form_check" class="form-inline formpage">
						<input type="hidden" value='{$page}' name="page" id="page-go" />
						<input type="hidden" value='{$list}' name="list" id="list-go" />
						<tr>
							<td>
								生产物料编号
							</td>
							<td>
								<input type="text" name="material_no" value="{$data.material_no}" class="form-control" />
							</td>
							<td>
								生产物料名称
							</td>
							<td>
								<input type="text" name="material_name" value="{$data.material_name}" class="form-control" />
							</td>
							<td>
								生产物料类别
							</td>
							<td>
								<select name="material_type_id" id="material_type_id" class="form-control select">
									<option value="0">全部</option>
									{volist name="leilist" id="vo"} {if condition="$vo.id eq $data.material_type_id"}
									<option selected value='{$vo.id}'>{$vo.type_name}</option>
									{else/}
									<option value='{$vo.id}'>{$vo.type_name}</option>
									{/if} {/volist}
								</select>
							</td>
						</tr>
						<tr>
							<td colspan="6" class="text-center">
								<input type="button" value="查询" class='btn btn-sm btn-info' id="check" />
								<input type="button" value="清空查询条件" class='btn btn-sm btn-info' id="clear_check" />
								<input type="button" value="导出Excel" class="btn btn-sm btn-info" />
							</td>
						</tr>
					</form>
				</tbody>
			</table>
			{if condition="$sum neq 0"}
			<table class="table table-hover table-bordered bud_hei table-striped bud_hei text-center" style="width: 100%;">
				<thead>
					<tr class='info'>
						<td>序号</td>
						<td>生产物料编号</td>
						<td>生产物料名称</td>
						<td>物料类别</td>
						<td>单位</td>
						<td>出厂价</td>
						<td>创建人</td>
						<td>创建时间</td>
						<td>修改人</td>
						<td>修改时间</td>
						<td>操作</td>
					</tr>

				</thead>
				<tbody>
					{volist name="matarr" id="vo"}
					<tr>
						<td>{$i}</td>
						<td>{$vo.material_no}</td>
						<td>{$vo.material_name}</td>
						<td>{$vo.type_name}</td>
						<td>{$vo.unit}</td>
						<td>{$vo.factory}</td>
						<td>{$vo.cname}</td>
						<td>{$vo.created_on}</td>
						<td>{$vo.mname}</td>
						<td>{$vo.modifiled_on}</td>
						<td mid='{$vo.id}'>
							<a href="javascript:;" class='updatem'>修改</a>
							<a href="javascript:;" class='dropm'>删除</a>
						</td>

					</tr>
					{/volist}

				</tbody>

			</table>
		  		<h5 class="text-center" id="pagesc" style="font-size: 16px;font-weight: 500">
            			<script>
                            $(function(){
                                pageSC("pagesc",{$sum},{$page},{$maxpage})
                            })
                        </script>每页显示
					<select id="pagesize">
						<option value='10' {if condition="$list eq 10"}selected{/if}>10条</option>
						<option value='15'{if condition="$list eq 15"}selected{/if}>15条</option>
						<option value='20'{if condition="$list eq 20"}selected{/if}>20条</option>

					</select>
				</h5> {else/}
			<h3 class="text-center">对不起没有查询到符合条件的信息</h3> {/if}

		</div>

		<!-- 全局js -->
		<script src="__STATIC__/layout/js/bootstrap.min.js?v=3.3.6"></script>
		
		<!-- 自定义js -->
		<script src="__STATIC__/layout/js/content.js?v=1.0.0"></script>
		<script src="__STATIC__/layout/js/plugins/sweetalert/sweetalert.min.js"></script>

		<!--统计代码，可删除-->
		<script>
			//删除
			$(".dropm").click(function() {
				var mid = $(this).parent().attr("mid");
				swal({
						title: "提示",
						text: "您真的要删除这个物料么？",
						type: "warning",
						showCancelButton: true,
						confirmButtonColor: "#FF3333",
						confirmButtonText: "是的我要删除",
						cancelButtonText: "取消",
						closeOnConfirm: true
					},
					function(isConfirm) {
						if(isConfirm) {
							//alert(cid);
							$.post("{:url('Materials/dropm')}", {
								mid: mid
							}, function(re) {
								//alert(re);
								if(re == 1) {
									swal({
										title: "完成",
										text: "物料已删除",
										type: "success"
									}, function() {
										location.href = '{:url("Materials/produce")}';
									});
								} else {
									swal({
										title: "错误",
										text: "系统繁忙请稍后再试",
										type: "warning"
									});
								}
							})
						}
					})

			})
			$(".updatem").click(function() {

				location.href = "{:url('Materials/add_materias')}?tid=1&mid=" + $(this).parent().attr("mid");
			})
			//翻页
			
			$("#check").click(function() {
				$("#page-go").val(1);
				$(".formpage").submit();
			})
			$("#clear_check").click(function() {
				$("input[type='text']").val("");
				$("#page-go").val(1);
				$("#material_type_id").val(0);
				$(".formpage").submit();
			})
			$(".add").click(function() {
				location.href = "{:url('Materials/add_materias')}?tid=1";
			})
			$(".huishou").click(function() {
				location.href = "{:url('Materials/produce_huishou')}";
			})
		</script>
	</body>

</html>